Skip to content

fix(middleware): native Node ESM imports (.js extensions) — @threadplane/middleware 0.0.2#675

Merged
blove merged 1 commit into
mainfrom
claude/middleware-esm-extensions
Jun 16, 2026
Merged

fix(middleware): native Node ESM imports (.js extensions) — @threadplane/middleware 0.0.2#675
blove merged 1 commit into
mainfrom
claude/middleware-esm-extensions

Conversation

@blove

@blove blove commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Bug found while live-smoking the JS LangGraph demo against the published 0.0.1.

The emitted ESM .js files had extensionless relative imports (export { … } from './middleware'). Bundlers (vitest, esbuild, langgraphjs dev) tolerate this — which is why the unit/integration tests and the demo all passed — but Node's native ESM resolver rejects it with ERR_MODULE_NOT_FOUND. So import '@threadplane/middleware/langgraph' from plain Node ESM (or strict NodeNext TS) was broken in 0.0.1.

Fix

Add explicit .js to every relative import in the source so tsc emits Node-ESM-correct specifiers. Bump to 0.0.2.

Verified

  • node --input-type=module import of the built package now loads all 9 exports (0.0.1 threw ERR_MODULE_NOT_FOUND on the same call).
  • Unit + in-process integration tests still green; lint 0 errors.

After merge (maintainer)

Republish @threadplane/middleware@0.0.2 (tarball provided in chat; or via the publish-middleware-npm.yml OIDC workflow now that the package exists). Consumers on ^0.0.1 (incl. the new cockpit/langgraph/client-tools/node demo) pick it up automatically.

🤖 Generated with Claude Code

…ESM) + bump 0.0.2

The emitted ESM .js files had extensionless relative imports (`from './middleware'`),
which bundlers (vitest/esbuild/langgraphjs dev) tolerate but Node's native ESM
resolver rejects with ERR_MODULE_NOT_FOUND — so `import '@threadplane/middleware/langgraph'`
broke for plain-Node consumers. Add explicit `.js` to all relative imports so tsc
emits Node-ESM-correct specifiers.

Verified: native `node --input-type=module` import of the built package now loads all
9 exports (0.0.1 threw ERR_MODULE_NOT_FOUND); unit + integration tests still green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@blove blove enabled auto-merge (squash) June 16, 2026 21:37
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 16, 2026 9:42pm

Request Review

@blove blove merged commit da4a829 into main Jun 16, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant